<template>
  <el-dialog :title="dialogProps.title" :visible.sync="dialogProps.visible" width="560px"
    @open="handleDialogOpen()" v-loading="loading">
    <div slot="title" class="dialog-header">{{ dialogProps.title }}</div>
    <el-form :model="Model" :rules="form"
      ref="Form" label-width="80px" label-position="right" size="small">
      <el-form-item label="快递员" prop="" label-width="120px">
        <el-col :span="16"><el-input :maxlength="32"  placeholder="请输入快递员"></el-input></el-col>
      </el-form-item>
    </el-form>
    <span slot="footer" class="dialog-footer">
      <el-button size="small" @click="handleDialogClose()">取 消</el-button>
      <el-button type="primary" size="small" @click="submitForm('Form')">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>

export default {
   name: "fpkdy-add",
    data() {
    return {
      loading: false,
      Model: {

      },
      dialogProps: {
        visible: false,
        action: '',
        title: ''
      },
      form: {

      }
    }
 },
  methods: {
    submitForm(formName) {
      this.$refs[formName].validate(valid => {
        if (valid) {
          if(this.dialogProps.action === 'add') {
            this.doSavekdy()
          }
        } else {
          return false
        }
      })
    },

    doSavekdy() {

    },
    handleDialogClose() {
      this.dialogProps.visible = false
    },
    handleDialogOpen() {
      this.$nextTick(() => {
        this.$refs['Form'].clearValidate()
      })
    },
    outputError(error) {
      console.log(error.response ? error.response : error.message)
      this.loading = false
      this.$message({
        showClose: true,
        message: '出错了，请按F12查看浏览器日志。',
        type: 'error'
      })
    }
  },
   mounted: function() {
    this.$nextTick(() => {
      this.$on('openAddfpkdyDialog', function() {
        this.dialogProps.action = 'add'
        this.dialogProps.title = '分配快递员'
        this.dialogProps.visible = true
      })
    })
  }
}
</script>

<style>

</style>
